package com.health.mapp.impl;

import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;
import org.apache.log4j.Logger;


import com.health.mapp.utils.Constant;
import com.health.mapp.utils.QueueConstant;
import com.health.mapp.utils.StringUtils;
 

public class InterfaceHelper {
	
	/*private static Logger logger = Logger.getLogger(InterfaceHelper.class);
	private static MemberCarService memberCarService = new MemberCarServiceImpl();
	private static MemberMedalService memberMedalService = new MemberMedalServiceImpl();
	private static CarModelService carModelService = new CarModelServiceImpl();
	private static MedalModelService medalModelService  = new MedalModelServiceImpl();
	*//**
	 * 
	 * @param memberId
	 * @param relationMedalId
	 * @return
	 *//*
	public static boolean checkMemberMedalRelation(long memberId,Integer relationMedalId)
	{
		boolean isExist=false;
		
		MemberMedalExt search= new MemberMedalExt();
		search.setMemberId(memberId);
		search.setMedalModelId(relationMedalId);
		int result=memberMedalService.checkMemberMedalRelation(search);
		if(result>0)
		{
			isExist=true;
		}

		return isExist;
	}
	*//**
	 * 
	 * @param memberId
	 * @param relationMedalId
	 * @return
	 *//*
	public static MemberMedal checkMemberMedalRelationByMedalType(long memberId,String relationMedalType)
	{
		boolean isExist=false;
		MemberMedal ret=null;
		MemberMedalExt search= new MemberMedalExt();
		search.setMemberId(memberId);
		search.setMedalType(relationMedalType);
		List<MemberMedal>  result=memberMedalService.checkMemberMedalRelationByType(search);
		if(null!=result && result.size()==1)
		{
			ret=result.get(0);
		}
		else
		{
			logger.debug("checkMemberMedalRelationByMedalType 数据异常！！！！！");
		}

		return ret;
	}
	
	*//**
	 * 
	 * @param memberId
	 * @param relationMedalId
	 * @return
	 *//*
	public static MemberMedal checkMemberMedalRelationByMedalTypeV2(long memberId, String key,String relationMedalType)
	{
		boolean isExist=false;
		MemberMedal ret=null;
		
		
		String str=PushDataFactory.getInstanse().get(key);
		
		if(null!=str  )
		{
			ret=(MemberMedal) StringUtils.jsonToBean("MemberMedal", str);
		}
		else
		{
			MemberMedalExt search= new MemberMedalExt();
			search.setMemberId(memberId);
			//search.setMedalType(relationMedalType);
			 List<MemberMedal> list=memberMedalService.checkMemberMedalRelationByType(search);
			 if(null!=list && list.size()>0)
			 { 
				 ret=list.get(0);
				 
			 }
			
		}

		return ret;
	}
	
	*//**
	 * 
	 * @param memberId
	 * @param relationCarId
	 * @return
	 *//*
	public static boolean checkMemberCarRelation(long memberId,Integer relationCarId)
	{
		boolean isExist=false;
		
		MemberCarExt search= new MemberCarExt();
		search.setMemberId(memberId);
		search.setCarModelId(relationCarId);
		int result=memberCarService.checkMemberCarRelation(search);
		if(result>0)
		{
			isExist=true;
		}

		return isExist;
	}
	
	*//**
	 * 
	 * @param memberId
	 * @param relationCarId
	 * @return
	 *//*
	public static MemberCar checkMemberCarRelationByCarType(long memberId,String relationCarType)
	{
		boolean isExist=false;
		MemberCar ret=null;
		MemberCarExt search= new MemberCarExt();
		search.setMemberId(memberId);
		search.setCarType(relationCarType);
		 List<MemberCar> result=memberCarService.checkMemberCarRelationByType(search);
		if(null!=result && result.size()==1)
		{
			ret=result.get(0);
		}
		else
		{
			
			logger.debug("checkMemberCarRelationByCarType 数据异常！！！！！");
		}

		return ret;
	}
	
	
	*//**
	 * 
	 * @param memberId
	 * @param relationCarId
	 * @return
	 *//*
	public static MemberCar checkMemberCarRelationByCarTypeV2(Long memberId,String key,String relationCarType)
	{
		boolean isExist=false;
		MemberCar ret=null;
		
		
		String str=PushDataTemplateFactory.getInstanse().get(key);
		
		if(null!=str  )
		{
			ret=(MemberCar) StringUtils.jsonToBean("MemberCar", str);
		}
		else
		{
			
			MemberCarExt search= new MemberCarExt();
			search.setMemberId(memberId);
			//search.setCarType(relationCarType);
			//logger.debug("checkMemberCarRelationByCarType 数据异常！！！！！");
			List<MemberCar> result=memberCarService.checkMemberCarRelationByType(search);
			if(null!=result && result.size()>0)
			{
				ret=result.get(0);
			}
				
		}

		return ret;
	}
	
	
	
	*//**
	 * 查询会员现在使用中的汽车
	 * @param member
	 * @return
	 *//*
	public static CarModel getMemberCurrentCar(Member member)
	{
		
		CarModel curr=null;
		MemberCarExt search = new MemberCarExt();
		search.setMemberId(member.getMemberId());
	
		search.setIsUsing(Constant.MEMBER_CAR_STATE_1_USING);
		List<MemberCar>  memberCarList=memberCarService.selectByCondition(search);
		if(null!=memberCarList && memberCarList.size()==1)
		{
		
			MemberCar temp=memberCarList.get(0);
			
			
			if (temp.getPace()==Constant.IS_EOUNGH_VISIT_ROUTE_FLAG) {
				curr=temp.getCarModel();
			}else{
				
				MemberCarExt searchf = new MemberCarExt();
				searchf.setMemberId(member.getMemberId());
				searchf.setCarModelId(temp.getLastLevel());
				
				curr = carModelService.selectByPrimaryKey(temp.getLastLevel());
				
				List<MemberCar>  memberCarListf=memberCarService.selectByCondition(searchf);
				
				if(null!=memberCarListf && memberCarListf.size()==1)
				{
					MemberCar tempf=memberCarListf.get(0);
					curr=tempf.getCarModel();
				}
			}
			
		}
		else
		{
		
			logger.error("memberCarList size is :"+memberCarList.size()+"!!!");
			logger.error("memberCarList size is :"+memberCarList.size()+"!!!");
			logger.error("memberCarList size is :"+memberCarList.size()+"!!!");
		}
		logger.info("currCar   is :"+curr+"!!!");
		return curr;
	
	}
	
	*//**
	 * 查询会员现在使用中的汽车
	 * @param member
	 * @return
	 *//*
	public static CarModel getMemberCurrentCarV2(Member member)
	{
		String mdn=member.getMobilePhone();
		CarModel curr=null;
		MemberCarExt search = new MemberCarExt();
		search.setMemberId(member.getMemberId());
	
		search.setIsUsing(Constant.MEMBER_CAR_STATE_1_USING);
		
		
		
		String str1=PushDataTemplateFactory.getInstanse().get(QueueConstant.MEMBER_LOGIN_USING_CAR_QUEUE_NAME + mdn);
		
		if(null!=str1 )
		{
			curr=(CarModel) StringUtils.jsonToBean("CarModel", str1);
			if(null==curr)
			{
				List<MemberCar>  memberCarList=memberCarService.selectByCondition(search);
				
				 
				if(null!=memberCarList && memberCarList.size()>0)
				{
				
					MemberCar temp=memberCarList.get(0);
					curr=temp.getCarModel();
					
				}
			}
		}
		 
		else
		{
			
			 
				List<MemberCar>  memberCarList=memberCarService.selectByCondition(search);
				
				 
				if(null!=memberCarList && memberCarList.size()>0)
				{
				
					MemberCar temp=memberCarList.get(0);
					curr=temp.getCarModel();
					
				}
				logger.info("currCar   is :"+curr+"!!!");
			
		}
		
	 
		
		return curr;
	
	}
	
	
	*//**
	 * 
	 * @param mm
	 * @param currentVisitNum
	 * @param medalObject4Calc
	 *//*
	public static void genMemberMedalPace(MemberMedal mm,int  currentVisitNum,MedalModel  medalObject4Calc )
	{
		logger.debug("genMemberMedalPace currentVisitNum:"+currentVisitNum);
		if(null!=medalObject4Calc && null!=mm)
		{
				float tempPace=  1f*currentVisitNum/medalObject4Calc.getUpperLimit();
				logger.debug("medal   tempPace:"+tempPace);
				 BigDecimal   b  =   new BigDecimal(tempPace);  
				 float   f1   =  b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); 
				//设置为新的进度
				//currPace=currPace+f1;
				 logger.debug("medal   currPace:"+f1);
				mm.setPace(f1);
			 
			
		}
		
	}
	
	*//**
	 * 
	 * @param mc
	 * @param currentVisitNum
	 * @param carObject4Calc
	 *//*
	public static void genMemberCarPace(MemberCar mc,int  currentVisitNum,CarModel  carObject4Calc )
	{
		if(null!=carObject4Calc && null!=mc)
		{
			
		 
				float tempPace=  1f*currentVisitNum/carObject4Calc.getUpperLimit();
			 
				BigDecimal   b  =   new BigDecimal(tempPace);  
				float   f1   =  b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); 
				//设置为新的进度
				//currPace=currPace+f1;
				  logger.debug("car   currPace:"+f1);
				mc.setPace(f1);
			 
		}
	
	
	}

	public static MedalModel  getV09MedalObject(Map<String,List<MedalModel>>     G_MEDAL_MODEL_LIST_MAP,String tag,int limitCond,String location)
	{
		MedalModel mm= null;
		if(null!=G_MEDAL_MODEL_LIST_MAP)
	    {
			List<MedalModel>  MEDAL_LIST=G_MEDAL_MODEL_LIST_MAP.get(tag+Constant.CONSTANTS_SEPARATOR+location);
	    	 	for(int i=0;i<MEDAL_LIST.size();i++)
				{
	    	 		MedalModel medalObject=(MedalModel) MEDAL_LIST.get(i);
			    	 
			    	 
				    	//MedalModel medalObjectNext=null;
				    	//if(i<V09_MEDAL_2_List.size())
				    	//{
				    	//	medalObjectNext=V09_MEDAL_2_List.get(i+1);
				    	//}
				    	//如果当前访问数量比当前对象上限小，说明就是此级别，因为是顺序的，因为等级必然是1级的上限比2级的限制少
				    	//比如路线访问勋章，1级为10条激活，而2级要20条才激活
				    	if(null!=medalObject && limitCond<=medalObject.getUpperLimit())
				    	{
				    		
				    	 
				    		mm=medalObject;
				    		
				    	}
				    	//else
				    	//{
				    		//如果当前访问数量比当前对象上限大，说明级别
				    	//	currentMedal2LevelId=medalObject.getMedalModelId();
				    	//	medal2Object4Calc=medalObjectNext;
				    	//}
				    	
				    	
					}
			    	 
			   
	    }
		
		
		return mm;
		
	}
	
	
	public static CarModel  getV09CarObject(Map<String,List<CarModel>> G_CAR_MODEL_LIST_MAP,String tag,int limitCond,String location)
	{
		CarModel cm=null;
		 if(null!=G_CAR_MODEL_LIST_MAP)
		 {
			 		List<CarModel>      CAR_LIST= G_CAR_MODEL_LIST_MAP.get(tag+Constant.CONSTANTS_SEPARATOR+location);
			 		if(null!=CAR_LIST && CAR_LIST.size()>0)
			 		{
			 			
			 			for(int i=0;i<CAR_LIST.size();i++)
						{
			    	 		CarModel carObject=CAR_LIST.get(i);
					    	//MedalModel medalObjectNext=null;
					    	//if(i<V09_MEDAL_2_List.size())
					    	//{
					    	//	medalObjectNext=V09_MEDAL_2_List.get(i+1);
					    	//}
					    	//如果当前访问数量比当前对象上限小，说明就是此级别，因为是顺序的，因为等级必然是1级的上限比2级的限制少
					    	//比如路线访问勋章，1级为10条激活，而2级要20条才激活
					    	if(null!=carObject && limitCond<=carObject.getUpperLimit())
					    	{
					    		
					     
					    		cm=carObject;
					    		
					    	}
					    	//else
					    	//{
					    		//如果当前访问数量比当前对象上限大，说明级别
					    	//	currentMedal2LevelId=medalObject.getMedalModelId();
					    	//	medal2Object4Calc=medalObjectNext;
					    	//}
					    	
					    	
						}
			 			
			 		}
		    	 	
		    }
		
		return cm;
		
		
		
	}
	
	
	*//**
	 *  用户注册后查看?条完整路线解锁
	 * @param currentMember
	 * @param G_CAR_MODEL_MAP
	 * @param G_CAR_MODEL_LIST_MAP
	 *//*
	public static void visitRouteLock(RouteVisitMemberExt currentMember, int visitNum,int visitNumByLocation,  Map<String,List<CarModel>>     G_CAR_MODEL_LIST_MAP)
	{
		logger.info("calcLoginDays currentMember:"+currentMember);
		if(null!=currentMember)
		{
			long memberId=currentMember.getMemberId();
			 int currentVisitNum=visitNum;
			//v0.9汽车模型数据
		    //List<CarModel>     V09_CAR_3_List= G_CAR_MODEL_LIST_MAP.get(Constant.V09_CAR_3+Constant.CONSTANTS_SEPARATOR+currentMember.getRelationRouteLocation());
		    //car3不分城市
			List<CarModel>     V09_CAR_3_List= G_CAR_MODEL_LIST_MAP.get(Constant.V09_CAR_3+Constant.CONSTANTS_SEPARATOR);
		    List<CarModel>     V09_CAR_4_List= G_CAR_MODEL_LIST_MAP.get(Constant.V09_CAR_4+Constant.CONSTANTS_SEPARATOR+currentMember.getRelationRouteLocation());
		    List<CarModel>     V09_CAR_5_List= G_CAR_MODEL_LIST_MAP.get(Constant.V09_CAR_5+Constant.CONSTANTS_SEPARATOR+currentMember.getRelationRouteLocation());
		 		 
		   
		    int currentCar3LevelId=0;
		    CarModel  car3Object4Calc=null;
		   
		    if(null!=V09_CAR_3_List)
		    {
		    	 	for(int i=0;i<V09_CAR_3_List.size();i++)
					{
				    	CarModel carObject=V09_CAR_3_List.get(i);
				    	if(null!=carObject && currentVisitNum<=carObject.getUpperLimit())
				    	{
				    		currentCar3LevelId=carObject.getCarModelId();
				    		car3Object4Calc=carObject;
				    		break;
				    	}

				    	 
				     
				    	
				    	
					}
		    	 	
		    	 	MemberCar memberCar3=InterfaceHelper.checkMemberCarRelationByCarType(memberId,Constant.V09_CAR_3);
					
		 		   //如果没有，直接写入一条
		 			if(null==memberCar3)
		 			{
		 				
		 				memberCar3 = new MemberCar();
		 				memberCar3.setCarModelId(currentCar3LevelId);
		 				memberCar3.setCarType(Constant.V09_CAR_3);
		 				memberCar3.setMemberId(memberId);
		 				 
		 				memberCar3.setIsUsing(Constant.MEMBER_CAR_STATE_2_UNUSING);
		 				//calc pace
		 				InterfaceHelper.genMemberCarPace(memberCar3, currentVisitNum, car3Object4Calc);
		 				 
		 				
		 				//直接插入关系表数据
		 				memberCarService.insert(memberCar3);
		 			}
		 			else
		 			{
		 				
		 				
		 				//已有记录，则需要把已有的记录级别进行更新为下一个等级
		 				logger.debug("memberMedal1 update4PaceByPrimaryKey");
		 				if(currentCar3LevelId>0)
		 				{
		 					//顺序不能反过来
		 					if(currentCar3LevelId!=memberCar3.getCarModelId())
		 					{
		 						memberCar3.setLastLevel(memberCar3.getCarModelId());
		 					}
		 					memberCar3.setCarModelId(currentCar3LevelId);
		 				}
		 				
		 				//calc pace
		 				InterfaceHelper.genMemberCarPace(memberCar3, currentVisitNum, car3Object4Calc );
		 				
		 				//更新旧的关系表数据为新数据 
		 				memberCarService.update4PaceByPrimaryKey(memberCar3);
		 				
		 			}
		 			
		 			
		    }
		 
		    
			 
		   
			 
		    int currentCar4LevelId=0;
		    CarModel  car4Object4Calc=null;
		    //int currentVisitNum=1;
		    if(null!=V09_CAR_4_List)
		    {
		    	 	for(int i=0;i<V09_CAR_4_List.size();i++)
					{
				    	CarModel carObject=V09_CAR_4_List.get(i);
				    	if(null!=carObject && currentVisitNum<=carObject.getUpperLimit())
				    	{
				    		currentCar4LevelId=carObject.getCarModelId();
				    		car4Object4Calc=carObject;
				    		//break;
				    	}

				    	 
				     
				    	
				    	
					}
		    	 	  MemberCar memberCar4=InterfaceHelper.checkMemberCarRelationByCarType(memberId,Constant.V09_CAR_4);
		  			
		   		   //如果没有，直接写入一条
		   			if(null==memberCar4)
		   			{
		   				
		   				memberCar4 = new MemberCar();
		   				memberCar4.setCarModelId(currentCar4LevelId);
		   				memberCar4.setCarType(Constant.V09_CAR_4);
		   				memberCar4.setMemberId(memberId);
		   				memberCar4.setIsUsing(Constant.MEMBER_CAR_STATE_2_UNUSING);
		   				//calc pace
		   				InterfaceHelper.genMemberCarPace(memberCar4, currentVisitNum, car4Object4Calc);
		   				 
		   				
		   				//直接插入关系表数据
		   				memberCarService.insert(memberCar4);
		   			}
		   			else
		   			{
		   				
		   				
		   				//已有记录，则需要把已有的记录级别进行更新为下一个等级
		   				logger.debug("memberMedal1 update4PaceByPrimaryKey");
		   				if(currentCar4LevelId>0)
		   				{
		   					//顺序不能反过来
		   					if(currentCar4LevelId!=memberCar4.getCarModelId())
		   					{
		   						memberCar4.setLastLevel(memberCar4.getCarModelId());
		   					}
		   					memberCar4.setCarModelId(currentCar4LevelId);
		   				}
		   				
		   				//calc pace
		   				InterfaceHelper.genMemberCarPace(memberCar4, currentVisitNum, car4Object4Calc );
		   				
		   				//更新旧的关系表数据为新数据 
		   				memberCarService.update4PaceByPrimaryKey(memberCar4);
		   				
		   			}
		   			
		    }
		 
		  
			 
		    int currentCar5LevelId=0;
		    CarModel  car5Object4Calc=null;
		//    int currentVisitNum=1;
		    if(null!=V09_CAR_5_List)
		    {
		    	 	for(int i=0;i<V09_CAR_5_List.size();i++)
					{
				    	CarModel carObject=V09_CAR_5_List.get(i);
				    	if(null!=carObject && currentVisitNum<=carObject.getUpperLimit())
				    	{
				    		currentCar5LevelId=carObject.getCarModelId();
				    		car5Object4Calc=carObject;
				    		//break;
				    	}

				    	 
				     
				    	
				    	
					}
		    	 	 MemberCar memberCar5=InterfaceHelper.checkMemberCarRelationByCarType(memberId,Constant.V09_CAR_5);
		 			
		  		   //如果没有，直接写入一条
		  			if(null==memberCar5)
		  			{
		  				
		  				memberCar5 = new MemberCar();
		  				memberCar5.setCarModelId(currentCar5LevelId);
		  				memberCar5.setCarType(Constant.V09_CAR_5);
		  				memberCar5.setMemberId(memberId);
		  				memberCar5.setIsUsing(Constant.MEMBER_CAR_STATE_2_UNUSING);
		  				//calc pace
		  				InterfaceHelper.genMemberCarPace(memberCar5, currentVisitNum, car5Object4Calc);
		  				 
		  				
		  				//直接插入关系表数据
		  				memberCarService.insert(memberCar5);
		  			}
		  			else
		  			{
		  				
		  				
		  				//已有记录，则需要把已有的记录级别进行更新为下一个等级
		  				logger.debug("memberMedal1 update4PaceByPrimaryKey");
		  				if(currentCar5LevelId>0)
		  				{
		  					//顺序不能反过来
		  					if(currentCar5LevelId!=memberCar5.getCarModelId())
		  					{
		  						memberCar5.setLastLevel(memberCar5.getCarModelId());
		  					}
		  					memberCar5.setCarModelId(currentCar5LevelId);
		  				}
		  				
		  				//calc pace
		  				InterfaceHelper.genMemberCarPace(memberCar5, currentVisitNum, car5Object4Calc );
		  				
		  				//更新旧的关系表数据为新数据 
		  				memberCarService.update4PaceByPrimaryKey(memberCar5);
		  				
		  			}
		  			
		    }
			
		}				    	 
	}
	
	  
	*//**
	 *  解锁任务勋章
	 * @param memberId 
	 * @param routeId
	 * @param visitNum
	 *//*
	public static void medalTaskLock(long memberId, int  routeId,int visitNum)
	{
			 int currentVisitNum=visitNum;
			 MedalModelExt medalModelExt = new MedalModelExt();
			 medalModelExt.setMedalTag(Constant.V09_MEDAL_4);
			 medalModelExt.setRouteId(routeId);
			 
		    //car3不分城市
		    List<MedalModel>    V09_MEDAL_4_List= medalModelService.selectByCondition(medalModelExt);
			 
		    int currentCar4LevelId=0;
		    MedalModel  car4Object4Calc=null;
		    //int currentVisitNum=1;
		    if(null!=V09_MEDAL_4_List)
		    {
		    	 	for(int i=0;i<V09_MEDAL_4_List.size();i++)
					{
		    	 		MedalModel medalModel=V09_MEDAL_4_List.get(i);
				    	if(null!=medalModel && currentVisitNum<=medalModel.getUpperLimit())
				    	{
				    		currentCar4LevelId=medalModel.getMedalModelId();
				    		car4Object4Calc=medalModel;
				    		break;
				    	}
					}
		    	 	MemberMedal memberMedal4=InterfaceHelper.checkMemberMedalRelationByMedalType(memberId,Constant.V09_MEDAL_4);
		  			
		   		   //如果没有，直接写入一条
		   			if(null==memberMedal4)
		   			{
		   				
		   				memberMedal4  =  new MemberMedal();
		   				memberMedal4.setMedalModelId(currentCar4LevelId);
		   				memberMedal4.setMedalType(Constant.V09_MEDAL_4);
		   				memberMedal4.setMemberId(memberId);
		   				
		   				//calc pace
		   				InterfaceHelper.genMemberMedalPace(memberMedal4, currentVisitNum, car4Object4Calc);
		   				//直接插入关系表数据
		   				
		   				memberMedalService.insert(memberMedal4);
		   			}
		   			else
		   			{
		   				
		   				//已有记录，则需要把已有的记录级别进行更新为下一个等级
		   				logger.debug("memberMedal1 update4PaceByPrimaryKey");
		   				if(currentCar4LevelId>0)
		   				{
		   					//顺序不能反过来
		   					if(currentCar4LevelId!= memberMedal4.getMedalModelId())
		   					{
		   						
		   						memberMedal4.setLastLevel(memberMedal4.getMedalModelId());
		   					}
		   					memberMedal4.setMedalModelId(currentCar4LevelId);
		   				}
		   				
		   				//calc pace
		   				InterfaceHelper.genMemberMedalPace(memberMedal4, currentVisitNum, car4Object4Calc);
		   				
		   				//更新旧的关系表数据为新数据 
		   				memberMedalService.update4PaceByPrimaryKey(memberMedal4);
		   			}
		   			
		    }
	}
		
		
	public static String sendGetHttp(String url, String message) {
		if (StringUtils.isBlank(url)) {
			logger.info("a blank url, return.");
			return "";
		}

		String uriAPI = "http://XXXXX?str=I+am+get+String";
		String result = "";
		// HttpGet httpRequst = new HttpGet(URI uri);
		// HttpGet httpRequst = new HttpGet(String uri);
		// 创建HttpGet或HttpPost对象，将要请求的URL通过构造方法传入HttpGet或HttpPost对象。
		HttpGet httpRequst = new HttpGet(url);

		// new DefaultHttpClient().execute(HttpUriRequst requst);
		try {
			// 使用DefaultHttpClient类的execute方法发送HTTP GET请求，并返回HttpResponse对象。
			HttpResponse httpResponse = new DefaultHttpClient()
					.execute(httpRequst);// 其中HttpGet是HttpUriRequst的子类
			if (httpResponse.getStatusLine().getStatusCode() == 200) {
				HttpEntity httpEntity = httpResponse.getEntity();
				result = EntityUtils.toString(httpEntity);// 取出应答字符串
				// 一般来说都要删除多余的字符
				result.replaceAll("\r", "");// 去掉返回结果中的"\r"字符，否则会在结果字符串后面显示一个小方格
			} 
			else
			{
				httpRequst.abort();
			}
			logger.debug("result:"+result);
		} catch (ClientProtocolException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			result = e.getMessage().toString();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			result = e.getMessage().toString();
		}

		return result;
	}*/
}
